home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Development / AmigaTalk / intuition / BoopsiClassNames.st < prev    next >
Encoding:
Text File  |  2004-01-31  |  2.2 KB  |  63 lines

  1. " ------------------------------------------------------------------- "
  2. " BoopsiClassNames Class is a Singleton class that allows the user to "
  3. " reference BOOPSI Class name Strings as Symbols.  The Boopsi Class   "
  4. " will create an instance of this for Boopsi Objects, so you do NOT   "
  5. " have to use this class yourself.                                    "
  6. ""
  7. "  EXAMPLE:  'myTag <- boopsiNames at: #IMAGECLASS'                   "
  8. ""
  9. " ALL singleton classes MUST contain the following:                   "
  10. ""
  11. "   the methods:  isSingleton AND privateSetup     AND                "
  12. "                 uniqueInstance Class instance variable.             "
  13. " ------------------------------------------------------------------- "
  14.  
  15. Class BoopsiClassNames :Dictionary ! uniqueInstance !
  16. [
  17.    isSingleton
  18.  
  19.      ^ true  
  20. |  
  21.    privateNew ! newInstance !
  22.  
  23.      newInstance <- super new.
  24.  
  25.      ^ newInstance
  26. |
  27.    new
  28.  
  29.      ^ (self privateSetup)
  30. |
  31.    privateSetup
  32.  
  33.      (uniqueInstance isNil)
  34.        ifTrue: [ uniqueInstance  <- self privateNew.
  35.  
  36.                  self privateSetupDictionary.     ].
  37.                
  38.      ^ self
  39. |
  40.    privateSetupDictionary     
  41.  
  42.      " Class id strings for Intuition classes.  There's no real 
  43.      * reason to use the uppercase constants over the lowercase 
  44.      * strings, but this makes a good place to list the names of
  45.      * the built-in (BOOPSI) classes:
  46.      "
  47.      self at: #ROOTCLASS     put: 'rootclass'.     " classusr.h      "
  48.      self at: #IMAGECLASS    put: 'imageclass'.    " imageclass.h "
  49.      self at: #FRAMEICLASS   put: 'frameiclass'.
  50.      self at: #SYSICLASS     put: 'sysiclass'.
  51.      self at: #FILLRECTCLASS put: 'fillrectclass'.
  52.      self at: #GADGETCLASS   put: 'gadgetclass'.   " gadgetclass.h "
  53.      self at: #PROPGCLASS    put: 'propgclass'.
  54.      self at: #STRGCLASS     put: 'strgclass'.
  55.      self at: #BUTTONGCLASS  put: 'buttongclass'.
  56.      self at: #FRBUTTONCLASS put: 'frbuttonclass'.
  57.      self at: #GROUPGCLASS   put: 'groupgclass'.
  58.      self at: #ICCLASS       put: 'icclass'.       " icclass.h "
  59.      self at: #MODELCLASS    put: 'modelclass'.
  60.      self at: #ITEXTICLASS   put: 'itexticlass'.
  61.      self at: #POINTERCLASS  put: 'pointerclass'.  " pointerclass.h "
  62. ]
  63.